<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/8/19
  Time: 16:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="resroot" value="${ctx}/common"/>
<c:set var="jsroot" value="${resroot}/js"/>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <link rel="stylesheet" href="${ctx}/common/css/bootstrap.min.css">
  <style>
    .row {
      margin-right: 0;
      margin-left: 0;
    }
    * {
      padding: 0px;
      margin: 0px;
      font-family: "微软雅黑";
    }
    .goods_list ul li{
      position: relative;
      background-color: #FFF;
      border-bottom: 1px solid #CCC;
      height: 120px;
      padding: 0 120px;
    }

    .goods_img{
      float: left;
      border: 1px solid #CCC;
      margin-left: 100px;
      width: 90px;
      height: 90px;
    }
    .goods_bottom{
      padding-top: 42px;
    }
    .goods_bottom .price{
      color: #F02028;
    }
    .goods_list .num{
      float: right;
    }
    .goods_list .num span{
      padding: 0 30px;
    }
    .pay {
      background-color: #FFF;
      width: 100%;
      height: 80px;
      position: fixed;bottom: 0;
    }
    .pay .totalNum{
      color: #F02028;
    }
    .pay span{
      color: #F02028;
    }
    .pay button{
      position: fixed;bottom:0;right: 0;
      width: 100px;
      height: 50px;
      background-color: #ff4001;
      color: #FFF;
      font-size: 12px;
    }


    .span-text {
      margin-top: 5px;
    }

    a {
      color: #05a;
      text-decoration: none;
    }

    a:hover {
      color: #0055aa;

    }



  </style>
</head>
<body>
<div style="position: fixed;z-index: 1;left: 0px;right: 0px;top: 0;">
  <div style="background: #f9f9f9;">
    <div class="container" style="height: 28px;">
      <div class="row nav1">
        <div class="col-xs-6">
          <div class="pull-left span-text">
            <span class="glyphicon glyphicon-map-marker"></span>广州
          </div>
        </div>
        <div class="col-xs-6">
          <div class="pull-right span-text">
            <span class="glyphicon glyphicon-user btn-link" style="color: #000;"></span>联系客服
            &nbsp;
            <span class="glyphicon glyphicon-comment btn-link" style="color: #000;"></span>微信
          </div>
        </div>
      </div>
    </div>
  </div>
  <hr style="margin-top: 0px;margin-bottom: 0px;">
  <div class="container" style="padding: 21px 0;background: #FFFFFF;opacity:0.9">
    <div class="row">
      <div class="col-xs-3">
        <a href="${ctx}/home.action"><img src="${ctx}/common/images/home/logo.png" style="padding-top: 12px;"/></a>
      </div>
      <div class="col-xs-6">
        <ul class="nav nav-pills nav-justified">
          <li class=><a href="${ctx}/home.action">首页</a></li>
          <li><a href="#">蛋糕</a></li>
          <li><a href="#">甜品</a></li>
          <li><a href="#">烘焙</a></li>
          <li><a href="#">礼品包装</a></li>
          <li><a href="#">我的诺心</a></li>
        </ul>
      </div>
      <div class="col-xs-3">
        <div class="pull-right">
          <button type="button" class="btn btn-link" style="padding: 6px 0px;"><a href="/login.action">登录</a></button>
          /
          <button type="button" class="btn btn-link" style="padding: 6px 0px;"><a href="/register.action">注册</a></button>
          <button id="headerCart" type="button" class="btn btn-link glyphicon glyphicon-shopping-cart"
                  style="padding: 6px 10px; color: #ff4001;"></button>
        </div>
      </div>
    </div>
  </div>
</div>

<div style="margin-top: 128px;width: 100%">
  <h4 class="text-center"><small style="float: left;margin-left: 80px">继续购物</small>您的购物车</h4>
</div>
<div style="margin-top: 20px">

  <div class="row">
    <div class="col-md-12 col-lg-12 col-sm-12">
      <div class="goods_list" style="padding:4px 10px;">
        <ul style="list-style: none">

          <c:forEach var="item" items="${cartItems}">
            <li>
              <span style="position:absolute;margin-top: 45px;padding-left: 30px"><input type="checkbox"></span>
              <img class="goods_img" src="${ctx}${item.url}" style="margin-top: 15px">
              <div class="goods_bottom text-center"><h4 style="float: left;margin-left: 50px">${item.goodsName}<small style="font-weight: bold;color: #ff4001;margin-left: 8px">（${item.speName}）</small>
              </h4><h4 class="goods_price" style="float: right;margin-right: 150px;color: #ff4001;">¥${item.price}</h4>
                <div class="num" style="margin-right: 60px;margin-top: 10px">
                  <a href="javascript:;"><span class="minus glyphicon glyphicon-minus" ></span></a>
                  <span>0</span>
                  <a href="javascript:;"><span class="plus glyphicon glyphicon-plus" ></span></a>
                </div>
              </div>
            </li>
          </c:forEach>

          <%--<li>
            <span style="position:absolute;margin-top: 40px;padding-left: 30px"><input type="checkbox"></span>
            <img class="goods_img" src="images/home/t_garden.jpg">
            <div class="goods_bottom text-center"><span style="padding-right: 240px">雪域牛乳蛋糕</span>¥<span class="goods_price">254.00</span>
              <div class="num">
                <a href="javascript:;"><span class="minus glyphicon glyphicon-minus" ></span></a>
                <span>0</span>
                <a href="javascript:;"><span class="plus glyphicon glyphicon-plus" ></span></a>
              </div>
            </div>
          </li>
          <li>
            <span style="position:absolute;margin-top: 40px;padding-left: 30px"><input type="checkbox"></span>
            <img class="goods_img" src="images/home/t_garden.jpg">
            <div class="goods_bottom text-center"><span style="padding-right: 240px">雪域牛乳蛋糕</span>¥<span class="goods_price">22.90</span>
              <div class="num">
                <a href="javascript:;"><span class="minus glyphicon glyphicon-minus" ></span></a>
                <span>0</span>
                <a href="javascript:;"><span class="plus glyphicon glyphicon-plus" ></span></a>
              </div>
            </div>
          </li>
          <li>
            <span style="position:absolute;margin-top: 40px;padding-left: 30px"><input type="checkbox"></span>
            <img class="goods_img" src="images/home/t_garden.jpg">
            <div class="goods_bottom text-center">
                            <span style="padding-right: 180px">雪域牛乳蛋糕<small style="font-weight: bold;color: #ff4001;margin-left: 8px">（5-8人分）</small>
                            </span>¥<span class="goods_price">7.00</span>
              <div class="num">
                <a href="javascript:;"><span class="minus glyphicon glyphicon-minus" ></span></a>
                <span>0</span>
                <a href="javascript:;"><span class="plus glyphicon glyphicon-plus" ></span></a>
              </div>
            </div>
          </li>--%>

        </ul>
        <div class="pay" style="opacity:0.9;z-index: 2;">
          <label ><span style="display: inline-block;margin-left: 110px"><input id="checkAll" type="checkbox"></span>全选</label>
          <p  style="margin-top: 20px;margin-left:200px;display: inline-block;" ></p>
          <p  style="margin-left:200px;display: inline-block;text-align: center">总价¥<span class="totalPrice">0</span></p><button type="submit">去付款</button>
        </div>
      </div>
    </div>
  </div>
</div>



<div style="background:#ebebeb;z-index: 0;">
  <div class="row" style="background: #ebebeb;padding-top: 50px;">
    <div class="col-xs-5"></div>
    <div class="col-xs-1 text-center">
      <a href="javascript:void(0);">
        <span class="glyphicon glyphicon-user" style="font-size: 30px;"></span>
        <small style="display: block;">客服</small>
      </a>
    </div>
    <div class="col-xs-1 text-center">
      <a href="javascript:void(0);">
        <span class="glyphicon glyphicon-cloud" style="font-size: 30px;"></span>
        <small style="display: block;">微信</small>
      </a>
    </div>
    <div class="col-xs-5"></div>
  </div>
  <div class="row text-center" style="background: #ebebeb;padding-top: 20px;">
    <small>客服电话：18578752336&nbsp;&nbsp;服务时间：（08:30-20:30）</small>
  </div>

  <div class="row" style="width: 1138px;padding:0;box-sizing: content-box">
    <div class="col-xs-2" style="padding: 0px;height: 56px;background:#ebebeb; "></div>
    <div class="col-xs-8">
      <ol class="breadcrumb text-center" style="background:#ebebeb; ">
        <li><a href="#">诺心公告</a></li>
        <li><a href="#">关于诺心</a></li>
        <li><a href="#">联系我们</a></li>
        <li><a href="#">客服服务</a></li>
        <li><a href="#">食品经营许可证</a></li>
        <li><a href="#">生产许可证</a></li>
        <li><a href="#">工商管理</a></li>
      </ol>
    </div>
    <div class="col-xs-2" style="padding: 0;height: 56px;background:#ebebeb;display: none; "></div>
  </div>
  <div class="row text-center" style="background: #ebebeb;padding-top: 20px;">
    <small>诺心食品（上海）有限公司 上海徐汇区田林路140号28号楼 客服邮箱：services@lecake.com 公司电话：4001-578-578</small>
  </div>
  <div class="row text-center"
       style="background: #ebebeb;padding-top: 20px;padding-bottom: 30px;">
    <small>copyright©2010-2017诺心lecake.com版权所有 沪ICP备10211730</small>
  </div>
</div>

<script type="text/javascript" src="${ctx}/common/js/jQuery-2.1.4.min.js"></script>
<script src="${ctx}/common/js/bootstrap.min.js"></script>
<script>



  //复选框选择
  function CheckList(obj) {
    var $checkbox = $(" ul li input[type = 'checkbox']");
    this.checkItem = obj.checkItem.not(obj.checkAll) || $checkbox.not(obj.checkAll);//所有复选框（不包含全选复选框）
    this.allCheckItem = obj.checkItem || $checkbox;//所有复选框
    this.checkAll = obj.checkAll;//全选复选框
    this.state = obj.state || false;//状态为true时，页面刚加载复选框默认都为选中
  }
  CheckList.prototype ={
    init:function() {
      this._check();
      if(this.state){
        this._allCheck();
      }else{
        this._notAllcheck();
      }
    },
    _check:function() {
      //单击全选
      var that = this;
      this.checkAll.on('click',function() {
        if($(this).prop('checked')){
          that.checkItem.prop('checked', true).parent().addClass('active');
          $(this).prop('checked', true).parent().addClass('active');
        }else{
          that.checkItem.prop('checked', false).parent().removeClass('active');
          $(this).prop('checked', false).parent().removeClass('active');
        }
      });
      //单击每个复选框（不包含全选复选框）
      this.checkItem.on('click',function() {
        var checkItem =Array.prototype.slice.call(that.checkItem);
        var flag =checkItem.every(function(elem,index,array) {
          return $(elem).prop('checked');
        });
        if($(this).prop('checked')){
          $(this).prop('checked',true).parent().addClass('active');
        }else{
          $(this).prop('checked',false).parent().removeClass('active');
        }
        if(flag){//如果都为选中
          that.checkAll.prop('checked', true).parent().addClass('active');
        }else{
          that.checkAll.prop('checked', false).parent().removeClass('active');
        }
      })
    },
    _allCheck:function() {// 全选
      this.allCheckItem.prop('checked', true).parent().addClass('active');
    },
    _notAllcheck:function() {//全不选
      this.allCheckItem.prop('checked', false).parent().removeClass('active');
    }
  };
  var checklistA = new CheckList({
    checkItem: $("input[type='checkbox']"),//所有复选框对象
    checkAll:$("#checkAll"),//全选复选框对象
    state:true//状态，为true全选中，为false为不选中（默认为false）
  });
  checklistA.init();
</script>
</body>
</html>
